package com.cvmars.jianyou.module.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.cvmars.jianyou.R;
import com.cvmars.jianyou.model.UserModel;
import com.cvmars.jianyou.model.UserRelativeModel;
import com.cvmars.jianyou.ui.CircleImageView;
import com.cvmars.jianyou.utils.ImageUtils;

import java.util.List;

/**
 * Created by hehaifeng on 2018/11/27.
 */

public class UserFollowingAdapter extends BaseQuickAdapter<UserRelativeModel,BaseViewHolder> {
    
    Context mContext;
    public UserFollowingAdapter(Context context,int layoutResId, @Nullable List<UserRelativeModel> data) {
        super(layoutResId, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, UserRelativeModel item) {


        CircleImageView iv_avator = helper.getView(R.id.iv_avator);
        UserModel customer = item.customer;
        ImageUtils.loadImage(mContext,customer.avatar_url,iv_avator);
        helper.setText(R.id.txt_name,customer.name)
        .setText(R.id.txt_guanzhu,customer.address_home)
        .setText(R.id.txt_intro,customer.intro);

        ImageView iv_sex = helper.getView(R.id.iv_sex);

        if (customer.gender == 1) {

            iv_sex.setImageResource(R.drawable.ic_male);
        } else {

            iv_sex.setImageResource(R.drawable.ic_women);
        }

    }
}
